package com.beone.smart.smartBeauty.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.beone.smart.smartBeauty.model.dto.WeightMeasureDto;
import com.beone.smart.smartBeauty.model.entity.WeightRecordDo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface WeightRecordDao extends BaseMapper<WeightRecordDo> {
    @Select("select count(*) as times,max(bmiNumber) as topBmi,MIN(bmiNumber) as miniBmi from weight_record where userId =#{uid}")
    WeightMeasureDto getTopAndTimes(@Param("uid") String uid);

    @Select("select weightRecord from weight_record where userId =#{uid} ORDER BY recordDate desc limit 1")
    Double getCurrentWeight(@Param("uid") String uid);
}
